/*******************************************************************************
 * Copyright (c) 2011 LegSem.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl-3.0.txt
 * 
 * Contributors:
 *     LegSem - initial API and implementation
 ******************************************************************************/
package com.legsem.legstar.cci;

import com.legstar.coxb.transform.IHostToJavaTransformer;
import com.legstar.coxb.transform.IJavaToHostTransformer;

/**
 * Describes an interaction with a the host with a single input structure and a
 * single output structure.
 * <p/>
 * Following the JCA specification the properties are bound.
 */
public class LegStarSingleIOInteractionSpecImpl extends
        LegStarInteractionSpecImpl implements LegStarSingleIOInteractionSpec {

    private static final long serialVersionUID = 165477653744340505L;

    private IJavaToHostTransformer inputTransformer;
    private IHostToJavaTransformer outputTransformer;

    public IJavaToHostTransformer getInputTransformer() {
        return inputTransformer;
    }

    public void setInputTransformer(IJavaToHostTransformer transformer) {
        IJavaToHostTransformer oldInputTransformer = inputTransformer;
        inputTransformer = transformer;
        firePropertyChange("InputTransformer", oldInputTransformer,
                inputTransformer);

    }

    public IHostToJavaTransformer getOutputTransformer() {
        return outputTransformer;
    }

    public void setOutputTransformer(IHostToJavaTransformer transformer) {
        IHostToJavaTransformer oldOutputTransformer = outputTransformer;
        outputTransformer = transformer;
        firePropertyChange("OutputTransformer", oldOutputTransformer,
                outputTransformer);

    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("LegStarSingleIOInteractionSpecImpl [inputTransformer=");
        builder.append((inputTransformer == null) ? null : inputTransformer
                .getClass().getName());
        builder.append(", outputTransformer=");
        builder.append((outputTransformer == null) ? null : outputTransformer
                .getClass().getName());
        builder.append(", ");
        builder.append(super.toString());
        builder.append("]");
        return builder.toString();
    }

}
